package com.briup.cms.web.controller;


import com.briup.cms.service.ICms_commentService;
import com.briup.cms.utils.Message;
import com.briup.cms.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(description = "评论管理接口")
@RestController
@RequestMapping("/cms_comment")
public class Cms_commentController {
    @Autowired
    private ICms_commentService cms_commentService;

    @ApiOperation("查询所有")
    @GetMapping("findAll")
    public Message findAll() {
        List<Cms_comment> list=cms_commentService.findAll();
        return MessageUtil.success(list);
    }

    @ApiOperation("保存或更新")
    @GetMapping("saveOrUpdate")
    public Message saveOrUpdate(Cms_comment cms_comment){
        cms_commentService.saveOrUpdate(cms_comment);
        return MessageUtil.success("操作成功");
    }


    @ApiOperation("删除")
    @PostMapping("deleteById")
    public Message deleteById(long id){
        cms_commentService.deleteById(id);
        return MessageUtil.success("删除成功");
    }
}
